package org.prem.collection;

/**
 * @author premkb
 *
 */
public class DepartmentBO {
	
	DepartmentBO(){
	}
	
	DepartmentBO(int id,String departmentCode){
		this.id=id;
		this.departmentCode=departmentCode;
	}
	
	private int id;
	
	private String departmentCode;
	
	private String departmentName;
	
	private String departmentDescription;

	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDepartmentCode() {
		return departmentCode;
	}

	public void setDepartmentCode(String departmentCode) {
		this.departmentCode = departmentCode;
	}

	public String getDepartmentName() {
		return departmentName;
	}

	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	public String getDepartmentDescription() {
		return departmentDescription;
	}

	public void setDepartmentDescription(String departmentDescription) {
		this.departmentDescription = departmentDescription;
	}
	
	public String toString(){
		String departmentCode = this.departmentCode!=null?this.departmentCode:"";
		String departmentName = this.departmentName!=null?this.departmentName:"";
		String departmentString = departmentCode+departmentName;
		return departmentString;
	}

	public boolean equals(Object o){
		System.out.println("inside equals...");
		if((o instanceof DepartmentBO) && ((DepartmentBO)o).getDepartmentCode().equals(this.departmentCode) && 
				((DepartmentBO)o).getId()==(this.id)){
			return true;
		}else{
			return false;
		}
		
	}
	
	public int hashCode(){
		int hashCode = this.id*2;
		System.out.println("hashCode for "+this.id+"--->"+hashCode);
		return hashCode;
	}
}
